#ifndef SERVER_H
#define SERVER_H
#ifdef _WIN32
#include <winsock2.h>
#pragma comment(lib,"Ws2_32.lib")
#endif
#ifdef linux
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#endif
#include <exception>
#include <iostream>
#include <string>
#include "data.h"
#include "letter.h"
using namespace std;
class server
{
protected :
    int slisten;//server listen
    unsigned int port;//port server
    unsigned int cl;//client id
    struct sockaddr_in serv;
    struct sockaddr_in client;
    data sen;
    data rec;
    //khoi tao winsock
    int serverinit();
    int servercreatesocket();
    int serverlisten();
    int serveraccept();
    int serverbind();
    int serversend();
    int serverrecv();
    void serverclose();
    void servercleanup();
    void serversocketclose();
    server();
    ~server();
};
#endif // SERVER_H
